package org.qb.mapreduce.reduceJoinDemo;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class ReduceJoinBean implements Writable {

    //order id
    private String orderId;
    //pid
    private String pId;
    //count
    private int count;
    //product name
    private String productName;
    //table name
    private String flag;

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeUTF(orderId);
        dataOutput.writeUTF(pId);
        dataOutput.writeInt(count);
        dataOutput.writeUTF(productName);
        dataOutput.writeUTF(flag);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {

        this.orderId = dataInput.readUTF();
        this.pId = dataInput.readUTF();
        this.count = dataInput.readInt();
        this.productName = dataInput.readUTF();
        this.flag = dataInput.readUTF();

    }

    @Override
    public String toString() {
        return orderId + '\t'  + productName + '\t' + count ;
    }
}
